/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package model.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Cacheable;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author dingnangen
 */
@Cacheable(false)
@Entity
@Table(name = "operationrecord")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Operationrecord.findAll", query = "SELECT o FROM Operationrecord o"),
    @NamedQuery(name = "Operationrecord.findByIdoperationrecord", query = "SELECT o FROM Operationrecord o WHERE o.idoperationrecord = :idoperationrecord"),
    @NamedQuery(name = "Operationrecord.findByFordate", query = "SELECT o FROM Operationrecord o WHERE o.fordate = :fordate"),
    @NamedQuery(name = "Operationrecord.findByState", query = "SELECT o FROM Operationrecord o WHERE o.state = :state")})
public class Operationrecord implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idoperationrecord")
    private Integer idoperationrecord;
    @Basic(optional = false)
    @NotNull
    @Column(name = "fordate")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fordate;
    @Basic(optional = false)
    @NotNull
    @Column(name = "state")
    private int state;
    @JoinColumn(name = "idsolution", referencedColumnName = "idsolution")
    @OneToOne(optional = false)
    private Solution idsolution;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idoperationrecord")
    private List<Tracehistory> tracehistoryList;

    public Operationrecord() {
    }

    public Operationrecord(Integer idoperationrecord) {
        this.idoperationrecord = idoperationrecord;
    }

    public Operationrecord(Integer idoperationrecord, Date fordate, int state) {
        this.idoperationrecord = idoperationrecord;
        this.fordate = fordate;
        this.state = state;
    }

    public Integer getIdoperationrecord() {
        return idoperationrecord;
    }

    public void setIdoperationrecord(Integer idoperationrecord) {
        this.idoperationrecord = idoperationrecord;
    }

    public Date getFordate() {
        return fordate;
    }

    public void setFordate(Date fordate) {
        this.fordate = fordate;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public Solution getIdsolution() {
        return idsolution;
    }

    public void setIdsolution(Solution idsolution) {
        this.idsolution = idsolution;
    }

    @XmlTransient
    public List<Tracehistory> getTracehistoryList() {
        return tracehistoryList;
    }

    public void setTracehistoryList(List<Tracehistory> tracehistoryList) {
        this.tracehistoryList = tracehistoryList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idoperationrecord != null ? idoperationrecord.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Operationrecord)) {
            return false;
        }
        Operationrecord other = (Operationrecord) object;
        if ((this.idoperationrecord == null && other.idoperationrecord != null) || (this.idoperationrecord != null && !this.idoperationrecord.equals(other.idoperationrecord))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "model.entity.Operationrecord[ idoperationrecord=" + idoperationrecord + " ]";
    }
    
}
